package com.yx.learn.domain;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Authority entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tauthority", catalog = "yx_01")
public class Authority implements java.io.Serializable {

	// Fields

	private Integer id;
	private Integer pid;
	private String authorityName;
	private String flag;
	private String url;
	private String memo;
	private Set<UserAuthority> userauthorities = new HashSet<UserAuthority>(0);
	private Set<Groupauthority> groupauthorities = new HashSet<Groupauthority>(
			0);
	private Set<Roleauthority> roleauthorities = new HashSet<Roleauthority>(0);

	// Constructors

	/** default constructor */
	public Authority() {
	}

	/** minimal constructor */
	public Authority(Integer id, Integer pid, String authorityName, String flag) {
		this.id = id;
		this.pid = pid;
		this.authorityName = authorityName;
		this.flag = flag;
	}

	/** full constructor */
	public Authority(Integer id, Integer pid, String authorityName,
			String flag, String url, String memo,
			Set<UserAuthority> userauthorities,
			Set<Groupauthority> groupauthorities,
			Set<Roleauthority> roleauthorities) {
		this.id = id;
		this.pid = pid;
		this.authorityName = authorityName;
		this.flag = flag;
		this.url = url;
		this.memo = memo;
		this.userauthorities = userauthorities;
		this.groupauthorities = groupauthorities;
		this.roleauthorities = roleauthorities;
	}

	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false)
	@GeneratedValue
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "pid", nullable = false)
	public Integer getPid() {
		return this.pid;
	}

	public void setPid(Integer pid) {
		this.pid = pid;
	}

	@Column(name = "authorityName", nullable = false, length = 64)
	public String getAuthorityName() {
		return this.authorityName;
	}

	public void setAuthorityName(String authorityName) {
		this.authorityName = authorityName;
	}

	@Column(name = "flag", nullable = false, length = 20)
	public String getFlag() {
		return this.flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}

	@Column(name = "url", length = 200)
	public String getUrl() {
		return this.url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@Column(name = "memo", length = 200)
	public String getMemo() {
		return this.memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "authority")
	public Set<UserAuthority> getUserauthorities() {
		return this.userauthorities;
	}

	public void setUserauthorities(Set<UserAuthority> userauthorities) {
		this.userauthorities = userauthorities;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "authority")
	public Set<Groupauthority> getGroupauthorities() {
		return this.groupauthorities;
	}

	public void setGroupauthorities(Set<Groupauthority> groupauthorities) {
		this.groupauthorities = groupauthorities;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "authority")
	public Set<Roleauthority> getRoleauthorities() {
		return this.roleauthorities;
	}

	public void setRoleauthorities(Set<Roleauthority> roleauthorities) {
		this.roleauthorities = roleauthorities;
	}

}